<?php
    $socket = @socket_create_listen("2055");

    if (!$socket) {
        print "Failed to create socket!\n";
	print socket_strerror(socket_last_error($socket));
        exit;
    }

    while (true) {
        $client = socket_accept($socket);
		$i=0;
        while (true) {
            $input = socket_read ($client, 500);
            //print "Them: $input\n";
			file_put_contents("pos.xml",$input);
			if($i++ >5)
				break;
        }
        socket_close ($client);
		break;
    }

    socket_close ($socket);
    print "Successfuly readed 5 updates from client!";
?>
